import { createRouter, createWebHistory } from 'vue-router';

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/login', 
    },
    {
      path: '/management',
      component: () => import('../views/management.vue'),
      children: [
        {
          path: 'Home',
          name: 'Home',
          component: () => import('../views/Home.vue'),
        },
        {
          path: 'test',
          name: 'test',
          component: () => import('../views/test.vue'),
        },
        {
          path: 'data',
          name: 'data',
          component: () => import('../views/data.vue'),
        },
        {
          path: 'User',
          name: 'User',
          component: () => import('../views/User.vue'),
        },
        {
          path: 'chat',
          name: 'chat',
          component: () => import('../views/chat.vue'),
        },
        {
          path: 'Exam',
          name: 'Exam',
          component: () => import('../views/ExamAI.vue'),
        },
        {
          path: 'Listener',
          name: 'Listener',
          component: () => import('../views/Listener.vue'),
        },
      ]
    },
    {
      path: '/404',
      name: 'Notfound',
      meta: { title: '404 找不到页面' },
      component: () => import('../views/404.vue'),
    },
    {
      path: '/:pathMatch(.*)*',
      redirect: '/404',
      name: 'notFound',
      meta: { title: '404 找不到页面' },
    },
    {
      path: '/login',
      name: 'Login',
      component: () => import('../views/Login.vue'),
    },
    {
      path: '/register',
      name: 'Register',
      component: () => import('../views/Register.vue'),
    },
    {
      path: '/grades',
      name: 'Grades',
      component: () => import('../views/Grades.vue'),
    },
    {
      path: '/learning',
      name: 'Learning',
      component: () => import('../views/Learning.vue'),
    },
    {
      path: '/profile',
      name: 'Profile',
      component: () => import('../views/Profile.vue'),
    },
    {
      path: '/xunfei',
      name: 'Xunfei',
      component: () => import('../views/xunfei.vue'),
    },
    {
      path: '/chat',
      name: 'chat',
      component: () => import('../views/chat.vue'),
    },
  ]
});

export default router;